<script language="javascript">
function get_val()
{
	var search_val = $('#search').val();
	document.techsearch.action = "index.php?page=technology&mode=view&srch_id="+search_val;
	document.techsearch.method="post";
	document.techsearch.submit();
}
function get_val1()
{
	var search_val = $('#search1').val();
	document.techsearch.action = "index.php?page=technology&mode=view&make_id="+search_val;
	document.techsearch.method="post";
	document.techsearch.submit();
}
</script>
<div class="mainWarpArea">
    <div class="contentwarp">
     <div class="contentwarpMiddle">
     <?php
		if($_GET['view']=="")
		{
		?>
        
            <div class="TechnologyTbl" style=" width:90%; border:0px; background-color:#FFF; padding:5px 5px 5px 30px; ">
            
            <form name="techsearch" method="post" >
            
                   <h1 class="titles">What are you shopping for?</h1>
                  Technology gadget &nbsp;
                    <select name="search" id="search" class="txtborder" style="width:180px;" onchange="return get_val();">
                 	  <option value="0" selected="selected">- Select -</option>
                 	 <?php  echo $base_obj->listGadget($gad_id)?>		  
                  </select>
                  &nbsp;&nbsp; Make
                  <select name="search" id="search1" class="txtborder" style="width:120px;" onchange="return get_val1();">
                  <option value="0" selected="selected">- Select -</option>
                     <?php echo $base_obj->listMake($make_id)?>
                  </select>
                  
              </form>
       <table border="0" cellspacing="2" cellpadding="2" width="100%">
          <tr>
            <td>
          <tr> 
            <td></td>
          </tr>
          <tr>
          <?php if($_GET['mode']==""){
			 $qry = "select * from ".$base_obj->GEDGET." WHERE 
				  active_status = '1' order by gadget_id asc"; 
				$res = $base_obj->exec_query($qry);
				$data = $base_obj->fetch_row_all($res);	

				$count = count($data);
				
				for($i=0;$i<$count;$i++) 
				{
					$src=$data[$i][gadget_image];
				
					echo '<td style="padding-bottom:40;" width="230px" >
					<table cellspacing="0" cellpadding="0" border="0" width="300px;" style="min-height:150px; height:150px;" class="borders">
			  <tr><td width="150" align="center">
					<img src="thumb.php?file=uploads/gadget_images/'.$src.'" &sizex=180&sizey=130/> </td>
					<td align="top">';
	
				   
				 $sql = "select id,make from ".$base_obj->GEDGET_TECH." WHERE 
					gadget='".$data[$i][gadget_id]."' and active_status = '1'group by make order by make  asc  LIMIT 0,5"; 
				
				$res_val = $base_obj->exec_query($sql);
				$data_val = $base_obj->fetch_row_all($res_val);	
				
				 $count_val = count($data_val);
				
				for($j=0;$j<$count_val;$j++) {
	
				echo '<a href="index.php?page=technology&mode=view&product_id='.$data_val[$j]['id'].'">
				'.$data_val[$j]['make'].'</a><br>';
				}
				
				echo '</td>
					 </tr>
					</table> 
					</td>';
					
				if(($i+1)%3 == 0) {
					echo '</tr>';
					
					if($i != count($i-1)) {
						echo '<tr>';
					}
	
				}
			}
		}
			  else
			  { ?>
              <td style="padding-bottom:6;padding-left:5;" colspan="2">
                                     <div style="float:left; width:900px;">
                                     <?php 
										 $qry = "select * from ".$base_obj->GEDGET_TECH." WHERE 
										id='".$_GET['product_id']."'  and active_status = '1' order by make  asc  LIMIT 0,5"; 
										$res = $base_obj->exec_query($qry);
										$data = $base_obj->fetch_row_all($res);				
										$count = count($data);
										for($i=0;$i<$count;$i++) 
										{
											if($data[$i]['image']=="")
		{
		$source ='<img src="thumb.php?file=images/noimage.jpg"  />';	
		}
		else
		{
		$source ='<img   src="thumb.php?file=uploads/gadget_images/'.$data[$i]['image'].'"/>';
		}
										     echo '<table border="0" class="viewTechnology">
											 <tr><td>'
											 .$data[$i]['make'].'
											 </td></tr>
											 <tr><td width="150px">'.$source.'</td>
											 <td valign="top">'.substr($data[$i]['specifications'],0,200).'
											 <br>price: $
											 '.$data[$i]['price'].'
											  <br>Quality:
											 '.$data[$i]['sale_flag'].'
											 <a href="'.$data[$i]['store_url'].'" target="_blank"><img src="images/button_buy_now.gif" style="float:right"/></a>
											 </td></tr>
										
											 
											 </table><br>';
											 
										}
										if($_GET['srch_id']!="")
										{
							/*$qry = "select * from ".$base_obj->GEDGET_TECH." WHERE 
										gadget='".$_GET['srch_id']."' or make like'%".$_GET['srch_id']."%' or
											specifications like'%".$_GET['srch_id']."%'
										and active_status = '1' order by make asc  LIMIT 0,5 ";*/
						   $qry = "select `store`, `store_url`, `gadget`, `make`, `specifications`, `price`,                   			                            `image`,g.gadget_name from ".$base_obj->GEDGET_TECH." gt LEFT JOIN ".$base_obj->GEDGET." g 
							ON gt.gadget =g.gadget_id 
							WHERE gadget='".$_GET['srch_id']."' or
							make like'%".$_GET['srch_id']."%' or
							specifications like'%".$_GET['srch_id']."%'or
							g.gadget_name like'%".$_GET['srch_id']."%'
							and gt.active_status = '1' order by make asc  LIMIT 0,5 ";			
										
										$res = $base_obj->exec_query($qry);
										$data = $base_obj->fetch_row_all($res);				
										$count = count($data);
										if($count>0){
										for($i=0;$i<$count;$i++) 
										{
								if($data[$i]['image']=="")
		{
		$source ='<img src="thumb.php?file=images/noimage.jpg" />';	
		}
		else
		{
		$source ='<img   src="thumb.php?file=uploads/gadget_images/'.$data[$i]['image'].'"/>';
		}			
										     echo '<div style="float:left; margin:5px 5px 5px 5px;"><div style="padding:3px 3px 3px 3px; width:430px;" class="borders"><table border="0" width="430"> 
											 <tr><td colspan="2" style="padding-left:155px; color:#005F96"><b>'
											 .$data[$i]['make'].'</b>
											 </td></tr>
											<tr><td width="150px" valign="top">'.$source.'</td>
											 <td valign="top">'.substr($data[$i]['specifications'],0,200).'
											 <br>price: <b style="color:#005F96">$'.$data[$i]['price'].'</b>
											  <br>Quality:
											 <b>'.$data[$i]['sale_flag'].'</b>
											 <a href="'.$data[$i]['store_url'].'" target="_blank"><img src="images/button_buy_now.gif" style="float:right"/></a>
											 </td></tr>
										
											 
											 </table></div></div>';
										}
										}
										 else
										  {
											echo '<p style="text-align:center;font-weight:bold">No Items Found</p>';
										  }
										}
										if($_GET['make_id']!="")
										{
								        $qry = "select * from ".$base_obj->GEDGET_TECH." WHERE 
										make like '".$_GET['make_id']."%' and active_status = '1' order by make asc  LIMIT 0,5"; 
										$res = $base_obj->exec_query($qry);
										$data = $base_obj->fetch_row_all($res);				
										$count = count($data);
										if($count>0){
										for($i=0;$i<$count;$i++) 
										{
		if($data[$i]['image']=="")
		{
		$source ='<img src="thumb.php?file=images/noimage.jpg"  />';	
		}
		else
		{
		$source ='<img  src="thumb.php?file=uploads/gadget_images/'.$data[$i]['image'].'"/>';
		}
											 echo '<div style="float:left; margin:5px 5px 5px 5px;"><div style="padding:3px 3px 3px 3px; width:430px;" class="borders"><table border="0" width="430"> 
												 <tr><td colspan="2" style="padding-left:155px; color:#005F96"><b>'
											 .$data[$i]['make'].'</b>
											 </td></tr>
											 <tr><td width="150px" valign="top">'.$source.'</td>
											 <td valign="top">'.substr($data[$i]['specifications'],0,200).'
											 <br>price: <b style="color:#005F96">$'.$data[$i]['price'].'</b>
											 <br>Quality:
											 <b>'.$data[$i]['sale_flag'].'</b>
											 <a href="'.$data[$i]['store_url'].'" target="_blank"><img src="images/button_buy_now.gif" style="float:right"/></a>
											 </td></tr>
											 </table></div></div>';
										}}
										else
										echo '<p style="text-align:center;font-weight:bold">No Items Found</p>';
										}
										?></div>
                                    </td>
                                    <?php }?>
              
          </tr>
          <tr>
            <td background="s_images/20/mdh2.gif"><img src="s_images/spacer.gif" height="2" width="2"></td>
          </tr>
          
        </table></div>
        <?php }

else if($_GET['view']=='advertise_products')
{
	if($_SESSION['user_id']!="")
	{
		
	include('advt_prod.php');
	}
	else
	{
		include('login.php');
	}
	
}

?>
      </div>
      <!-- End contentwarpMiddle -->
    
      
   
      
      <!-- End contentwarp -->
       <?php include("includes/right_content.php");?>
      <div style="clear:both;"></div>
    </div>
    <!-- End mainWarpArea -->
    <div style="clear:both;"></div>
  </div>
  <!-- End Wrapper -->
